# Replication Package: When Does Demography Move Capital? A Nonlinear Framework

## Overview
This folder contains all files needed to replicate the analysis in "When Does Demography Move Capital?" The paper shows the demographic-capital flow relationship is not a single number — the Z₁ coefficient ranges from -112 (OECD/EMU) to +98 (high-income non-OECD), a 210pp spread. Income level is the master moderator; the "OECD null" is a composition effect where high income (amplifying) cancels against socialized lifecycle costs (attenuating). Out-of-sample validation correctly predicts 7/8 subsample coefficient signs.

## Requirements
- Python 3.10+
- pandas, numpy, scipy, statsmodels
- Data files in data/processed/

## Structure
- `scripts/` — Analysis scripts (run in phase order)
- `src/` — Shared modules (PanelGLS estimator, data loading, country classifications)
- `data/processed/` — Processed panel data (unified_panel.csv, phase2_varying_coefficients.csv)
- `output/tables/` — Generated output tables
- `paper/` — Paper manuscript

## Reproduction
Run scripts in numerical phase order:
```
python scripts/phase1_data_assembly.py
python scripts/phase2_varying_coefficients.py
python scripts/phase3_oecd_null.py
python scripts/phase4_thresholds.py
python scripts/phase5_coefficient_surface.py
python scripts/phase6_reconciliation.py
python scripts/phase7_extensions.py
```

## Data Sources
- UN World Population Prospects 2024
- IMF World Economic Outlook
- Penn World Table 10.01
- Chinn-Ito KAOPEN Index
- Lane & Milesi-Ferretti External Wealth of Nations
- Aizenman-Chinn-Ito Trilemma Indices

## Notes
- All analysis uses the 140-country expanded panel (237 countries, 1950-2024)
- The `src/` modules are shared with the multilateral project and contain the expanded country lists
- This is the capstone paper reconciling all 17 companion papers
- Income interactions dominate: Z₁×income_high=+84 (p<0.01); Z₁×income_low=-101 (p<0.01) on CA
- OADR thresholds (15%, 20%, 25%) all null — conditioning is institutional, not demographic
- Out-of-sample: pre-2010 model predicts 7/8 post-2010 subsample coefficient signs correctly
